﻿@model SlideCategory
<div class="page">
    <div class="pageContent">
        <form method="post" action="/sys/slide/category/@(Model.Id)" class="pageForm required-validate"
        onsubmit="return validateCallback(this, dialogAjaxDone);">
        <div class="pageFormContent">
            <div>
                <p>
                    <label>
                        状态：
                    </label>
                    <select name="Status">
                        <option value="True">可用</option>
                        <option value="False">不可用</option>
                    </select>
                </p>
                <p>
                    <label>
                        标 题：
                    </label>
                    <input type="text" name="Title" value="@(Model.Title)" class="required"/>
                </p>
                <p>
                    <label>
                        图片宽：
                    </label>
                    <input type="text" name="Width" value="@(Model.Width)" class="required digit"/>
                </p>
                <p>
                    <label>
                        图片高：
                    </label>
                    <input type="text" name="Height" value="@(Model.Height)" class="required digit"/>
                </p>
                <p>
                    <label>
                        缩略图：
                    </label>
                    <select name="Thumb" onchange="changeVal(this);">
                        <option value="True" @(Model.Thumb ? "selected=selected" : string.Empty)>生成</option>
                        <option value="False" @(!Model.Thumb ? "selected=selected" : string.Empty)>不生成</option>
                    </select>
                </p>
                <div id='thumbdiv' style="display: @(!Model.Thumb ? "none" : string.Empty);">
                    <p>
                        <label>
                            缩略图宽：
                        </label>
                        <input type="text" name="ThumbW" value="@(Model.ThumbW)" class="required digit"/>
                    </p>
                    <p>
                        <label>
                            缩略图高：
                        </label>
                        <input type="text" name="ThumbH" value="@(Model.ThumbH)" class="required digit"/>
                    </p>
                </div>
                <p>
                    <label>
                        优先级：
                    </label>
                    <input type="text" name="Priority" value="@(Model.Priority)" class="required digit"/>
                </p>
                <p>
                    <label>
                        备注：
                    </label>
                    <input type="text" name="Extra" value="@(Model.Extra)" />
                </p>
                <p>
                    <label>
                        描述：
                    </label>
                    <input type="text" name="Description" value="@(Model.Description)" />
                </p>
            </div>
        </div>
        <div class="formBar">
            <ul>
                <li>
                    <div class="buttonActive">
                        <div class="buttonContent">
                            <button type="button" onclick="this.form.onsubmit();">
                                保存</button></div>
                    </div>
                </li>
                <li>
                    <div class="button">
                        <div class="buttonContent">
                            <button type="button" onclick="$.pdialog.closeCurrent();">
                                取消</button></div>
                    </div>
                </li>
            </ul>
        </div>
        </form>
    </div>
</div>
<script type="text/javascript">
    function changeVal(obj) {
        var val = $(obj).val();
        if (val == 'True') {
            $('#thumbdiv').show();
            $('input', '#thumbdiv').addClass('digit');
        }
        else {
            $('#thumbdiv').hide();
            $('input', '#thumbdiv').removeClass('digit');
        }
    }
</script>
